package com.woniuxy.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.entity.ClientAccount;
import com.woniuxy.entity.ClientBill;
import com.woniuxy.service.ClientAccountService;
import com.woniuxy.utils.Result;

@Controller
@RequestMapping("/clientaccount")
public class ClientAccountController {
	@Autowired 
	private ClientAccountService clientAccountService;
	@RequestMapping("/all")
	@ResponseBody
	public Result<List<ClientAccount>> all(){
		Result<List<ClientAccount>> result = new Result<>();
		result.setData(clientAccountService.all());
		return result;
	
	}
	@RequestMapping("/updateBegin")
	@ResponseBody
	public Result<List<ClientAccount>> updateBegin(int caid){
		Result<List<ClientAccount>> result = new Result<>();
		if(clientAccountService.updateBegin(caid)==1){
			result.setStatus(Result.SUCCESS);
			result.setMessage("ok");
		}else{
			result.setStatus(Result.ERROR);
			result.setMessage("no");
		}
		return null;
		
	}
	@RequestMapping("/updateEnd")
	@ResponseBody
	public Result<List<ClientAccount>> updateEnd (int caid){
		Result<List<ClientAccount>> result = new Result<>();
		if(clientAccountService.updateEnd(caid)==1){
			result.setStatus(Result.SUCCESS);
			result.setMessage("ok");
		}else{
			result.setStatus(Result.ERROR);
			result.setMessage("no");
		}
		return null;
		
	}
	
	
}
